/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package runapplication;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;

/**
 *
 * @author richard
 */
public class update {

    private String sinaline;

    public update(String url) {
        sinaline = null;

        {
            try {

                DefaultHttpClient dhc = new DefaultHttpClient();
                dhc.getParams().setLongParameter("http.connection-manager.timeout", 5000);
                HttpPost httppost = new HttpPost(url);
                HttpResponse execute = dhc.execute(httppost);
                InputStream content = execute.getEntity().getContent();
                BufferedReader br = new BufferedReader(new InputStreamReader(content));

                sinaline = br.readLine();

            } catch (Exception ex) {
                return;
            }
        }
    }

    public String getsl() {
        if (sinaline != null) {
            sinaline = sinaline.substring(sinaline.indexOf("\""));
            return sinaline;
        } else {
            return null;
        }
    }
}
